<!doctype html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>登录</title>
<meta name="keywords" th:content="#{site.seo.keywords}">
<meta name="description" th:content="#{site.seo.description}">

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

<link rel="shortcut icon" th:href="@{/assets/favicon.ico}" href="/favicon.ico" />
<link rel="bookmark" th:href="@{/assets/favicon.ico}" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/jquery-confirm/2.5.1/jquery-confirm.min.css">
<link rel="stylesheet" th:href="@{/assets/adminlte/css/AdminLTE.min.css}">
<link rel="stylesheet" th:href="@{/assets/adminlte/css/skins/skin-purple-light.min.css}">
<link rel="stylesheet" th:href="@{/assets/adminlte/css/custom.css}">
<link rel="stylesheet" href="//cdn.bootcss.com/iCheck/1.0.2/skins/square/blue.css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="//cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
  <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body class="hold-transition login-page">
	<div class="login-box">
		<div class="login-logo">
			<a th:href="@{/}" th:text="#{site.name}">System Name</a>
		</div>
		<!-- /.login-logo -->
		<div class="login-box-body">
			<p class="login-box-msg">登录</p>

			<form th:action="@{/login}" method="post">
				<div class="form-group has-feedback">
					<input type="text" class="form-control" name="username" placeholder="账号" autocomplete="off"
						data-bv-notempty="true" data-bv-notempty-message="请填写账号" data-bv-stringlength="true" data-bv-stringlength-min="2"
						data-bv-stringlength-max="10" data-bv-stringlength-message="账号必须是2-10个字符之间"> <span
						class="glyphicon glyphicon-user form-control-feedback"></span>
				</div>
				<div class="form-group has-feedback">
					<input type="password" class="form-control" name="password" placeholder="密码" data-bv-notempty="true"
						data-bv-notempty-message="请填写密码"> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
				</div>
				<div class="form-group has-feedback">
					<div class="input-group">
						<input type="text" class="form-control" placeholder="请输入验证码" name="captcha" data-bv-notempty="true"
							data-bv-notempty-message="请填写验证码" aria-describedby="validate-code-addon"> <span class="input-group-btn"
							id="validate-code-addon"> <a href="javascript:;" id="refreshCaptchaButton"> <img
								th:src="@{/captcha.jpg}" style="height: 34px;" />
						</a>
						</span>
					</div>
				</div>

				<div class="row">
					<div class="col-xs-8">
						<div class="checkbox icheck">
							<label> <input type="checkbox"> 记住我
							</label>
						</div>
					</div>
					<!-- /.col -->
					<div class="col-xs-4">
						<button type="submit" class="btn btn-primary btn-block btn-flat">登录</button>
					</div>
					<!-- /.col -->
				</div>
			</form>
<!-- 
			<div class="social-auth-links text-center">
				<p>- 或者 -</p>

				<a th:href="@{/authorization/qqOauthPlugin}" class="btn btn-block btn-social btn-qq btn-flat"> <i
					class="fa fa-qq"></i> 使用QQ登录
				</a> <a th:href="@{/authorization/weiboOauthPlugin}" class="btn btn-block btn-social btn-weibo btn-flat"> <i
					class="fa fa-weibo"></i> 使用微博登录
				</a> <a th:href="@{/authorization/githubOauthPlugin}" class="btn btn-block btn-social btn-github btn-flat"> <i
					class="fa fa-github"></i> 使用Github登录
				</a>
			</div>
 -->
			<!-- /.social-auth-links -->

			<a th:href="@{/forgotPassword}">忘记密码？</a> <br> <a th:href="@{/register}" href="register.html"
				class="text-center">注册成为会员</a>

		</div>
	</div>
	<!-- /.login-box -->

	<!-- REQUIRED JS SCRIPTS -->

	<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js"></script>
	<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script type="text/javascript"
		src="http://cdn.staticfile.org/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>
	<script src="//cdn.bootcss.com/iCheck/1.0.2/icheck.min.js"></script>
	<script src="//cdn.bootcss.com/jquery-confirm/2.5.1/jquery-confirm.min.js"></script>
	<script type="text/javascript" th:inline="javascript">
		var base = /*[[${#httpServletRequest.getContextPath()}]]*/"";
		if (typeof requirejs != 'undefined') {
			require([ "domReady" ], function(domReady) {
				domReady(function() {
					location.reload(true);
					return;
				})
			})
		} else {
			$(function() {
				$('input').iCheck({
					checkboxClass : 'icheckbox_square-blue',
					radioClass : 'iradio_square-blue',
					increaseArea : '20%' // optional
				});
				$("form")
						.bootstrapValidator()
						.on(
								'success.form.bv',
								function(e) {
									e.preventDefault();

									var $form = $(e.target);

									var bv = $form.data('bootstrapValidator');

									$
											.post(
													$form.attr('action'),
													$form.serialize(),
													function(result) {
														if (result.success) {
															$(".login-box-msg").nextAll(".alert").remove();
															location.href = base + "/";
														} else {
															$(".login-box-msg").nextAll(".alert").remove();
															$(".login-box-msg")
																	.after(
																			"\
										<div class=\"alert alert-danger alert-dismissible\" role=\"alert\">\
										  <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\
										  <strong>错误提示!</strong> "
																					+ result.msg + "\
										</div>");
															$("#refreshCaptchaButton").children("img").attr("src",
																	base + "/captcha.jpg?_t=" + new Date().getTime());
															$form.bootstrapValidator('disableSubmitButtons', false);
														}
													}, 'json');
								});

				$("#refreshCaptchaButton").on("click", function() {
					$(this).children("img").attr("src", base + "/captcha.jpg?_t=" + new Date().getTime());
				});
			});
		}
	</script>
</body>
</html>
